//app.js
import {
  requst_post_login,
  requst_get_getUserInfo
} from '/utils/api.js'
App({
  onLaunch: function () {
    this.globalData = {
      plusPoint: 2,//加积分类型
      subtractPoint: 1,//减积分类型
      adAddPoint: 2,//广告加积分
      downloadPoint: 2,
      userInfo: null,
      varsion:1//审核版本
    }
  },
  loginWx: function () {
    wx.login({
      success: res1 => {
        const params = {
          jsCode: res1.code,
        };
        requst_post_login(params).then(res => {
          requst_get_getUserInfo({}).then(res => {
            this.globalData.userInfo = res.data
            wx.showToast({
              title: '登录成功',
            })
            console.log('全局用户信息', this.globalData.userInfo)
          })
        })
      },
      fail: err => {
        console.log(err)
      }
    });
  },
  
})